//
// Created by scvzerng on 2024-02-05.
//
#include "napi.h"
#include <string>
#include <vector>
#include "windows.h"

#ifndef SCVZERNG_TOOLS_WINDOW_API_H
#define SCVZERNG_TOOLS_WINDOW_API_H

#endif //SCVZERNG_TOOLS_WINDOW_API_H

class Window {
public:
    /**
     * 窗口句柄
     */
    HWND handler;
    /**
     * 窗口标题
     */
    std::string title;
    /**
     * 窗口类名
     */
    std::string className;
    /**
     * 执行文件
     */
    std::string fileName;

    [[maybe_unused]] Napi::Object convertNApiObject(Napi::Env env){
        auto window = Napi::Object::New(env);
        window.Set(Napi::String::New(env, "handler"), Napi::Number::New(env, reinterpret_cast<uint64_t>(handler)));
        window.Set(Napi::String::New(env, "title"), Napi::String::New(env, title));
        window.Set(Napi::String::New(env, "className"), Napi::String::New(env, className));
        window.Set(Napi::String::New(env, "fileName"), Napi::String::New(env, fileName));
        return window;
    }
};

std::vector<Window> getAllWindows();